package com.hs.communication.common.fallback;

import com.hs.common.core.domain.Result;
import com.hs.communication.common.entity.Charger;
import com.hs.communication.common.entity.ChargerData;
import com.hs.communication.common.entity.dto.ParaDto;
import com.hs.communication.common.entity.vo.DeviceVo;
import com.hs.communication.common.feign.RemoteChargerService;
import com.hs.communication.common.feign.RemoteSocketService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

@Slf4j
@Component
public class RemoteSocketFallbackFactory implements FallbackFactory<RemoteSocketService> {

    @Override
    public RemoteSocketService create(Throwable cause) {
        log.error("获取充电桩统计数据远程服务调用失败:{}", cause.getMessage());
        return new RemoteSocketService() {
            @Override
            public Result<Boolean> setParameter(ParaDto paraDto,String source) {
                return Result.fail(false, "socket设置参数失败,服务降级");
            }
        };
    }
}
